package com.kyle.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.kyle.dao.UserDao;
import com.kyle.entity.UserEntity;

@Controller
@SuppressWarnings({"rawtypes","unchecked"})
@RequestMapping("/login")
public class LoginAction {

	@Autowired
	@Qualifier(value="userDao")
	private UserDao userDao;
	
	@RequestMapping(value="/login.xhtml")
	public String login(ModelMap modelMap,String username,String password,
			HttpServletRequest request){
		try {
			UserEntity userEntity = new UserEntity();
			userEntity.setUsername("xiha");
			userEntity.setTitle("dd");
			request.getSession().setAttribute("user", userEntity);
			System.out.println(username+":"+password);
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return "../index";
	}
}
